var router = require('../routes/router');
var db = require('../exts/db/database.js');

router.get('/', function(req, res) {
	res.render('index', { title: 'NodeFM' });
});

router.get('/userList', function(req, res) {
	var sql = 'SELECT * FROM sys_user';

    db.getRecordPaged(sql,req.query,function(err,result){
        res.send(result);
    });
});

router.get('/mytest', function(req, res) {
	var sql = 'select * from (SELECT * FROM sys_user) v where 1 = 1 and (UserName = :username) limit 0,20 ';
    var p = {};
    p['username'] = 'admin';

    db.exec(sql,p,function(err,data){
        res.send(data);
    });
});


module.exports = router;
